#include<bits/stdc++.h>
using namespace std;
int n , x , q[110];
int main(){
	freopen("jump.in" , "r" , stdin);
	freopen("jump.out" , "w" , stdout);
	cin >> n;
	for(int i = 1 ; i <= n ; i++) cin >> q[i];
	cin >> x;
	for(int i = n ; i >= x ; i--) q[i + 1] = q[i];
	q[x] = q[n + 1];
	for(int i = 1 ; i <= n ; i++) cout << q[i] << " ";
	cout << endl;
	return 0;
}